<template>
  <div class="person">
    <h2>我是Person组件</h2>
    <input type="text" placeholder="名字">
    <input type="text" placeholder="年龄">
    <button>添加</button>
    <ul>
      <li v-for="p in personList" :key="p.id">{{p.name}}--{{p.age}}</li>
    </ul>
  </div>
</template>

<script>
  import { mapState } from 'vuex'

  export default {
    name:'Person',
    computed:{
      ...mapState(['personList'])
    }
  }
</script>

<style scoped>
  .person {
    background-color: orange;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 0 10px black;
  }
  input{
    margin-right: 10px;
    width: 100px;
  }
</style>